//弹出ajax请求的对话框
function et_ajaxWin(title,url){
	var dialog = art.dialog({id: title});
	$.ajax({
	    url: url,
	    success: function (data) {
	        dialog.content(data).title(title);
	    },
	    cache: false
	});
	return dialog;
}
//关闭页面上所有对话框
function et_closeAll(){
	var list = art.dialog.list;
	for (var i in list) {
	    list[i].close();
	};
}
//登陆框
function et_loginWin(title,url){
	var dialog = et_ajaxWin(title,url).lock();
	dialog.button({
	    name: '登录',
	    focus: true,
	    callback: function () {et_ajaxSubmit('loginForm');return false;}
	}, {
	    name: '取消'
	});
}
//ajax提交form表单 并且结果显示在指定的位置,position==null 则显示在对话框里面
function et_ajaxSubmit(id,position){
	if(document.getElementById(id)==null){
		return ;
	}
	var success = function(data){
		if (position == null) {
			$(".aui_content").html(data);
		}else{
			$(position).html(data);
		}
	}
	var options = { success :success};
	document.getElementById(id).submit=function() {
	    $(this).omAjaxSubmit(options);
	    return false;//返回false,阻止浏览器默认行为
	}
	document.getElementById(id).submit();
}

//有确定按钮的通知
function et_alert(title,message){
	art.dialog.alert(message);
}
//提示
function et_tips(message){
	art.dialog.tips(message);
}
//弹出iframe框
function et_iframeWin(title,url){
	var dialog = art.dialog.open(url, {title: title});
}
//右下角弹出提示
function et_notice(title,content,width,icon){
	art.dialog.notice({
	    title: title,
	    width: width,// 必须指定一个像素宽度值或者百分比，否则浏览器窗口改变可能导致artDialog收缩
	    content: content,
	    icon: icon,
	    time:5
	});
}

function et_search(wd){
	wd = $.trim(wd);//忽略空格
	if (wd==null||wd=="") {
		et_alert("系统提示","请输入关键字");
		return;
	}
	wd = encodeURIComponent(encodeURIComponent(wd));
	location.href="/music/s.do?wd="+wd;
}
//音乐搜索按钮
function et_search_click(inp){
	var wd = $(inp).prev().val();
	et_search(wd);
}
//音乐搜索框 回车
function et_search_enter(inp){
	var e = document.all ? event:arguments.callee.caller.arguments[0];
	var key = e.keyCode || e.which;
	if(key==13){
		var wd = $(inp).val();
		et_search(wd);
		if ($.browser.ie) {
			e.returnValue = false;
		} else {
			e.preventDefault();
		}
	}
}

function et_tab() {  
	var e = document.all ? event:arguments.callee.caller.arguments[0];
	var key = e.keyCode || e.which;
    if (key == 13 ) {  
    	key = 9;  
    }  
} 
